﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_ThemSanPhamMoi : System.Web.UI.Page
{
    private DataSet objLoaiSPDS;
    private DataSet objNSXDS;

    protected void Page_Load(object sender, EventArgs e)
    {
        LoadControl();

        string loaisp = Request.QueryString["loaisp"];
        string nsx = Request.QueryString["nsx"];

        LoaiSanPhamBUS objLoaiSP = new LoaiSanPhamBUS(TGDDConfiguration.DbConnectionString);
        objLoaiSPDS = objLoaiSP.SelectTenLoaiSanPham(int.Parse(loaisp));
        DataRow row = objLoaiSPDS.Tables[0].Rows[0];
        lblLoaiSP.Text = row["TenLoaiSanPham"].ToString();

        NhaSanXuatBUS objNSX = new NhaSanXuatBUS(TGDDConfiguration.DbConnectionString);
        objNSXDS = objNSX.SelectTenNSX(int.Parse(nsx));
        row = objNSXDS.Tables[0].Rows[0];
        lblNSX.Text = row["TenNSX"].ToString();
    }

    private void LoadControl()
    {
        string loaisp = Request.QueryString["loaisp"];
        LoaiSanPhamBUS objLoaiSP = new LoaiSanPhamBUS(TGDDConfiguration.DbConnectionString);
        objLoaiSPDS = objLoaiSP.SelectTenLoaiSanPham(int.Parse(loaisp));
        DataRow row = objLoaiSPDS.Tables[0].Rows[0];
        string tenloaisp = row["TenLoaiSanPham"].ToString();
        Control c = Page.LoadControl(Request.ApplicationPath +
                       "/admin/MyUserControls/TH_ThemSanPham.ascx");
        adminPlaceHolder.Controls.Add(c);
    }

}
